package org.example;

import com.alibaba.fastjson.JSON;
import util.SignUtil;

/**
 * Hello world!
 */
public class App {
    public static void main(String[] args) {

        String host = "http://api.fat.jabriel.cn";
        String path = "/api/v1/device/playText";
        String appId = "10003";
        String appSecret = "7MlBaItY3pjRwn3as2qIRmSLXNTAwjobOVz7X3C5uSyMYN0H62P4J8f0hhMMDC4r";
        String corpId = "746120909d6783b0922badde9473905d";
        long timestamp = System.currentTimeMillis();
        Body body = new Body();
        body.setCorpId(corpId);
        body.setDeviceNo("SYAW2YAOLINGLING0000012");
        body.setContent("齐鲁银行提醒您，微信收款2元");
        String signStr = null;
        try {
            signStr = SignUtil.sign(appId, appSecret, timestamp, path, JSON.toJSONString(body));
        } catch (Exception e) {
            System.out.printf(e.getMessage());
        }
//        Header header = new Header();
//        header.setAuthorization(signStr);
//        Request request = new Request();
//        request.setHeader(header);
//        request.setBody(body);
        //设备编号：SYAW2YAOLINGLING0000012


        System.out.println(JSON.toJSONString(body));
        System.out.println("authorization");
        System.out.println(signStr);
    }
}
